import { website } from '@/config.js';
import { dataList } from './dataSource';
//基本配置
export const config = {
	width: 1920,
	height: 1080,
	query: '',
	header: '',
	mark: {
		show: false,
		text: '',
		fontSize: 20,
		color: 'rgba(100,100,100,0.2)',
		degree: -20
	},
	filter: {
		show: false,
		contrast: '', //对比度
		brightness: '', //亮度
		opacity: '', //不透明度
		saturate: '', //饱和度
		'hue-rotate': '' //色相 度
	},
	scale: 1,
	backgroundImage: `/img/bg/bg.png`,
	url: '',
	gradeShow: false,
	gradeLen: 30
};
// 颜色的配置
export const colorOption = {
	menuWidth: 150,
	refreshBtn: false,
	columnBtn: false,
	labelWidth: 100,
	column: [
		{
			label: '颜色',
			prop: 'color1',
			type: 'color'
		},
		{
			label: '渐变色',
			prop: 'color2',
			type: 'color'
		},
		{
			label: '位置',
			prop: 'postion',
			type: 'number'
		}
	]
};
// 基础表格列配置
export const tableOption = {
	menuWidth: 140,
	refreshBtn: false,
	columnBtn: false,
	labelWidth: 100,
	column: [
		{
			label: '名称',
			prop: 'label',
			width: 120
		},
		{
			label: 'key值',
			prop: 'prop',
			width: 120,
			hide: true
		},
		{
			label: '宽度',
			prop: 'width',
			hide: true
		},
		{
			label: '列排序',
			prop: 'order',
			type: 'number',
			hide: true
		},
		{
			label: '列类型',
			prop: 'columnType',
			type: 'select',
			hide: true,
			value: '',
			dicData: [
				{
					label: '文本',
					value: 'text'
				},
				{
					label: '标签',
					value: 'tag'
				},
				{
					label: '图片',
					value: 'picture'
				},
				{
					label: '进度条',
					value: 'progress'
				},
				{
					label: '开关',
					value: 'switch'
				},
				{
					label: '滑块',
					value: 'slider'
				}
			],
			control: val => {
				if (val === 'progress') {
					return {
						strokeWidth: {
							display: true
						},
						customColor: {
							display: true
						},
						isRadius: {
							display: true
						}
					};
				} else {
					return {
						strokeWidth: {
							display: false
						},
						customColor: {
							display: false
						},
						isRadius: {
							display: false
						}
					};
				}
			}
		},
		{
			label: '进度条高度',
			prop: 'strokeWidth',
			type: 'number',
			value: 20,
			min: 10,
			hide: true
		},
		{
			label: '是否带弧度',
			prop: 'isRadius',
			type: 'switch',
			hide: true,
			value: false,
			dicData: [
				{
					label: '否',
					value: false
				},
				{
					label: '是',
					value: true
				}
			]
		},
		{
			label: '进度条颜色',
			prop: 'customColor',
			type: 'color',
			value: '#409eff',
			hide: true
		},
		{
			label: '状态',
			prop: 'hide',
			type: 'switch',
			hide: true,
			value: false,
			dicData: [
				{
					label: '隐藏',
					value: true
				},
				{
					label: '显示',
					value: false
				}
			]
		}
	]
};

// 事件表格配置
export const tableEventOption = {
	menuWidth: 140,
	refreshBtn: false,
	columnBtn: false,
	labelWidth: 100,
	column: [
		{
			label: '字段',
			prop: 'field'
		},
		{
			label: '绑定变量',
			prop: 'bindValue',
			width: 100
		},
		{
			label: '继承字段',
			prop: 'extendField',
			hide: true
		},
		{
			label: '事件索引',
			prop: 'eventIndex',
			type: 'number',
			value: 0,
			hide: true
		},
		{
			label: '字段说明',
			prop: 'desc',
			type: 'textarea',
			span: 24,
			minRows: 3,
			maxRows: 5,
			hide: true
		}
	]
};

// 滚动表格列配置
export const scrollTableOption = {
	menuWidth: 150,
	refreshBtn: false,
	columnBtn: false,
	labelWidth: 100,
	column: [
		{
			label: '名称',
			prop: 'label'
		},
		{
			label: 'key值',
			prop: 'prop'
		},
		{
			label: '宽度',
			prop: 'width',
			type: 'number',
			hide: true
		}
	]
};
// 基础表格预警配置
export const tableAlarmOption = {
	menuWidth: 150,
	refreshBtn: false,
	columnBtn: false,
	labelWidth: 120,
	column: [
		{
			label: '预警字段',
			prop: 'alarmField'
		},
		{
			label: '预警值',
			prop: 'alarmValue'
		},
		{
			label: '预警判断',
			prop: 'alarmJudge',
			type: 'select',
			hide: true,
			value: '>=',
			dicData: [
				{
					label: '>=',
					value: '>='
				},
				{
					label: '>',
					value: '>'
				},
				{
					label: '<=',
					value: '<='
				},
				{
					label: '<',
					value: '<'
				},
				{
					label: '=',
					value: '=='
				},
				{
					label: '!=',
					value: '!='
				}
			]
		},
		{
			label: '预警排序',
			prop: 'alarmOrder',
			type: 'number',
			min: 0,
			hide: true
		},
		{
			label: '预警文本颜色',
			prop: 'alarmColor',
			type: 'color',
			value: 'rgba(255, 255, 255, 1)',
			hide: true
		},
		{
			label: '预警背景色',
			prop: 'alarmBgColor',
			type: 'color',
			value: '',
			hide: true
		}
	]
};

// 滚动表格预警配置
export const scrollTableAlarmOption = {
	menuWidth: 150,
	refreshBtn: false,
	columnBtn: false,
	labelWidth: 120,
	column: [
		{
			label: '预警字段',
			prop: 'alarmField'
		},
		{
			label: '预警值',
			prop: 'alarmValue'
		},
		{
			label: '预警判断',
			prop: 'alarmJudge',
			type: 'select',
			hide: true,
			value: '>=',
			dicData: [
				{
					label: '>=',
					value: '>='
				},
				{
					label: '>',
					value: '>'
				},
				{
					label: '<=',
					value: '<='
				},
				{
					label: '<',
					value: '<'
				},
				{
					label: '=',
					value: '=='
				},
				{
					label: '!=',
					value: '!='
				}
			]
		},
		{
			label: '预警排序',
			prop: 'alarmOrder',
			type: 'number',
			min: 0,
			hide: true
		},
		{
			label: '预警文本颜色',
			prop: 'alarmColor',
			type: 'color',
			value: 'rgba(255, 255, 255, 1)',
			hide: true
		}
	]
};

// 系列配置
export const tableSeriesOption = {
	menuWidth: 150,
	refreshBtn: false,
	columnBtn: false,
	labelWidth: 150,
	column: [
		{
			label: '系列名',
			prop: 'seriesName'
		},
		{
			label: '系列类型',
			prop: 'seriesType',
			type: 'select',
			value: 'line',
			dicData: [
				{
					label: '线图',
					value: 'line'
				},
				{
					label: '柱图',
					value: 'bar'
				},
				{
					label: '堆叠图',
					value: 'stack'
				}
			]
		},
		{
			label: '标签数值',
			prop: 'labelShow',
			type: 'switch',
			hide: true,
			value: true,
			dicData: [
				{
					label: '隐藏',
					value: false
				},
				{
					label: '显示',
					value: true
				}
			]
		},
		// {
		//     label: "标签数值旋转角度",
		//     prop: "labelRotate",
		//     hide: true,
		//     type: "number"
		// },
		// {
		//     label: "标签数值字体大小",
		//     prop: "labelShowFontSize",
		//     hide: true,
		//     type: "number"
		// },
		// {
		//     label: "标签数值字体颜色",
		//     prop: "labelShowColor",
		//     hide: true,
		//     type: "color"
		// },
		// {
		//     label: "标签数值字体粗细",
		//     prop: "labelShowFontWeight",
		//     type: "select",
		//     hide: true,
		//     value: "normal",
		//     dicData: [
		//         { label: "默认", value: "normal" },
		//         { label: "粗体", value: "bold" },
		//         { label: "加粗", value: "bolder" },
		//         { label: "加细", value: "ligter" }
		//     ]
		// },
		// {
		//     label: "标签数值内容格式化",
		//     prop: "formatter",
		//     hide: true,
		//     placeholder: "{b}名称 {c}数值 {d}百分比数值"
		// },
		{
			label: '标签数值位置',
			prop: 'labelLocation',
			hide: true,
			labelTip: `可输入值： top / left / right / bottom / inside /<br />
                            insideLeft / insideRight / insideTop /
                            insideBottom<br />
                            / insideTopLeft / insideBottomLeft<br />
                            / insideTopRight / insideBottomRight或10,
                            10`,
			labelTipPlacement: 'right'
		}
	]
};

// 数据映射配置
export const dataMapFieldConfig = {
	menuWidth: 100,
	maxHeight: 300,
	refreshBtn: false,
	columnBtn: false,
	addBtn: false,
	delBtn: false,
	column: [
		{
			label: '字段',
			width: 120,
			overHidden: true,
			prop: 'field'
		},
		{
			label: '映射',
			overHidden: true,
			prop: 'mapField'
		}
	]
};
//一些字典的配置
export const dicOption = {
	eventList: ['tabs', 'text', 'flop', 'colorBlocks', 'dataRotate'],
	// 数据源配置
	dataList: dataList(website),
	// 数据源配置
	// 视频倍速播放
	playbackRate: [
		{
			label: 0.5,
			value: 0.5
		},
		{
			label: 1,
			value: 1
		},
		{
			label: 2,
			value: 2
		},
		{
			label: 3,
			value: 3
		}
	],
	fixedType: [
		{ label: '手输行数', value: 'rows' },
		{ label: '字段条件', value: 'field' }
	],
	fixedJudge: [
		{
			label: '>=',
			value: '>='
		},
		{
			label: '>',
			value: '>'
		},
		{
			label: '<=',
			value: '<='
		},
		{
			label: '<',
			value: '<'
		},
		{
			label: '=',
			value: '=='
		},
		{
			label: '!=',
			value: '!='
		}
	],
	// 水位图类型
	waterLevelType: [
		{ label: '矩形', value: 'rect' },
		{ label: '圆角矩形', value: 'roundRect' },
		{ label: '圆形', value: 'round' }
	],
	// 按钮风格
	buttonStyle: [
		{ label: '默认', value: '' },
		{ label: '主要', value: 'primary' },
		{ label: '成功', value: 'success' },
		{ label: '信息', value: 'info' },
		{ label: '警告', value: 'warning' },
		{ label: '危险', value: 'danger' },
		{ label: '文字', value: 'text' }
	],
	// 图片展示风格
	imgDisplayMode: [
		{ label: '默认', value: 'fill' },
		{ label: '宽铺满高等比', value: 'contain' },
		{ label: '高铺满宽等比', value: 'cover' },
		{ label: '宽高不变', value: 'none' },
		{ label: '保持原有比例', value: 'scale-down' }
	],
	direction: [
		{ label: '向下', value: 'down' },
		{ label: '向上', value: 'up' },
		{ label: '向左', value: 'left' },
		{ label: '向右', value: 'right' }
	],
	scrollDirection: [
		{ label: '向下', value: 0 },
		{ label: '向上', value: 1 },
		{ label: '向左', value: 2 },
		{ label: '向右', value: 3 }
	],
	line: [
		{ label: '线条', value: 'line' },
		{ label: '圆环', value: 'circle' }
	],
	fontWeight: [
		{ label: '默认', value: 'normal' },
		{ label: '粗体', value: 'bold' },
		{ label: '加粗', value: 'bolder' },
		{ label: '加细', value: 'ligter' }
	],
	border: [
		{ label: '无边框', value: '' },
		{ label: '内置图片', value: 'img' },
		{ label: '内置边框', value: 'border' }
	],
	borderType: [
		{ label: '无边框', value: 'none' },
		{ label: '点状', value: 'dotted' },
		{ label: '虚线', value: 'dashed' },
		{ label: '实线', value: 'solid' },
		{ label: '双线', value: 'double' }
	],
	justifyContent: [
		{ label: '居中', value: 'center' },
		{ label: '左对齐', value: 'flex-start' },
		{ label: '右对齐', value: 'flex-end' }
	],
	textAlign: [
		{ label: '居中', value: 'center' },
		{ label: '左对齐', value: 'left' },
		{ label: '右对齐', value: 'right' }
	],
	dataType: [
		{ label: '静态数据', value: 0 },
		{ label: 'API接口', value: 1 },
		{ label: 'SQL数据', value: 2 },
		{ label: 'WebSocket', value: 3 },
		{ label: '查看订阅', value: 4 },
		{ label: '订阅数据', value: 5 }
	],
	// 轮播图指示器位置
	indicatorPosition: [
		{ label: '内部', value: '' },
		{ label: '外部', value: 'outside' },
		{ label: '隐藏', value: 'none' }
	],
	// 触发方式
	trigger: [
		{ label: '点击', value: 'click' },
		{ label: '悬浮', value: 'hover' }
	],
	orientList: [
		{ label: '竖排', value: 'vertical' },
		{ label: '横排', value: 'horizontal' }
	],
	dataMethod: [
		{ label: 'GET', value: 'get' },
		{ label: 'DELETE', value: 'delete' },
		{ label: 'POST', value: 'post' },
		{ label: 'PUT', value: 'put' }
	],
	labelPosition: [
		{ value: 'outside', label: '外侧' },
		{ value: 'inside', label: '内部' }
	],
	themeList: [
		{
			label: '默认配色',
			value: 'avue'
		},
		{
			label: '紫色主题',
			value: 'macarons'
		},
		{
			label: '绿色主题',
			value: 'wonderland'
		},
		{
			label: '科技主题',
			value: 'walden'
		}
	],
	barList: ['lineBar', 'pictorialbar'], // X轴设置
	yAxisShow: ['lineBar'], //左Y轴
	doubleYAxis: ['lineBar'], //右Y轴
	dataZoom: ['lineBar'], //区域缩放
	seriesColumn: ['lineBar'], // 系列配置
	threeAngle: ['pie3D', 'circleBar3D'], // 3d角度
	titleList: ['lineBar', 'pictorialbar', 'pie', 'pie3D', 'radar', 'circleBar3D', 'funnel', 'drilldownBar'], //标题设置
	labelList: ['lineBar', 'pie', 'radar', 'scatter', 'drilldownBar'], //数值设置
	legendList: ['lineBar', 'pie', 'radar', 'funnel', 'pie3D', 'drilldownBar'], //图例设置
	colorList: ['lineBar', 'pie', 'gauge', 'funnel', 'scatter', 'radar', 'pie3D', 'circleBar3D', 'drilldownBar'], //颜色设置
	seriesColorList: ['capsuleChart'], //ECHARTS 系列颜色设置
	tipList: ['lineBar', 'pie', 'funnel', 'scatter', 'radar', 'drilldownBar'], //提示语设置
	postionList: ['lineBar', 'pictorialbar', 'pie3D', 'circleBar3D', 'drilldownBar'], //轴距离设置
	labelFormatterList: ['lineBar', 'map', 'pie', 'gauge', 'funnel', 'scatter', 'radar'],
	tabsTypeList: [
		{
			label: '选项卡',
			value: 'tabs'
		},
		{
			label: '选择框',
			value: 'select'
		}
	],
	selectStyleList: [
		{
			label: '默认',
			value: '1'
		},
		{
			label: '白底黑字',
			value: '2'
		},
		{
			label: '透明',
			value: '3'
		}
	],
	mapType: [
		{
			label: '原生',
			value: 0
		}
	],
	target: [
		{ label: '本窗口', value: '_self' },
		{ label: '新窗口', value: '_blank' }
	],
	swiperType: [
		{ label: '普通', value: '' },
		{ label: '立体', value: 'card' }
	],
	swiperIndicator: [
		{ label: '外部', value: 'indicator' },
		{ label: '不显示', value: 'none' }
	],
	format: [
		{ label: '日期', value: 'yyyy-MM-dd' },
		{ label: '日期+时分', value: 'yyyy-MM-dd hh:mm' },
		{ label: '日期+时分秒', value: 'yyyy-MM-dd hh:mm:ss' },
		{ label: '日期(无年)', value: 'MM-dd' },
		{ label: '时分', value: 'hh:mm' },
		{ label: '时分秒', value: 'hh:mm:ss' },
		{ label: '星期', value: 'day' }
	],
	fontFamily: [
		{ label: '宋体', value: 'SimSun' },
		{ label: '新宋体', value: 'NSimSun' },
		{ label: '黑体', value: 'SimHei' },
		{ label: '楷体', value: 'KaiTi_GB2312' },
		{ label: '微软雅黑', value: 'Microsoft YaHei' },
		{ label: '幼园', value: 'YouYuan' },
		{ label: '华文细黑', value: 'STXihei' },
		{ label: '细明体', value: 'MingLiU' },
		{ label: '新细明体', value: 'PMingLiU' }
	],
	animated: [
		{ label: '渐显', value: 'fadeIn' },
		{ label: '向右进入', value: 'fadeInLeft' },
		{ label: '向左进入', value: 'fadeInRight' },
		{ label: '向上进入', value: 'fadeInUp' },
		{ label: '向下进入', value: 'fadeInDown' },
		{ label: '向右长距进入', value: 'fadeInLeftBig' },
		{ label: '向左长距进入', value: 'fadeInRightBig' },
		{ label: '向上长距进入', value: 'fadeInUpBig' },
		{ label: '向下长距进入', value: 'fadeInDownBig' },
		{ label: '旋转进入', value: 'rotateIn' },
		{ label: '左顺时针旋转', value: 'rotateInDownLeft' },
		{ label: '右逆时针旋转', value: 'rotateInDownRight' },
		{ label: '左逆时针旋转', value: 'rotateInUpLeft' },
		{ label: '右逆时针旋转', value: 'rotateInUpRight' },
		{ label: '弹入', value: 'bounceIn' },
		{ label: '向右弹入', value: 'bounceInLeft' },
		{ label: '向左弹入', value: 'bounceInRight' },
		{ label: '向上弹入', value: 'bounceInUp' },
		{ label: '向下弹入', value: 'bounceInDown' },
		{ label: '光速从右进入', value: 'lightSpeedInRight' },
		{ label: '光速从左进入', value: 'lightSpeedInLeft' },
		{ label: '光速从右退出', value: 'lightSpeedOutRight' },
		{ label: '光速从左退出', value: 'lightSpeedOutLeft' },
		{ label: 'Y轴旋转', value: 'flip' },
		{ label: '中心X轴旋转', value: 'flipInX' },
		{ label: '中心Y轴旋转', value: 'flipInY' },
		{ label: '左长半径旋转', value: 'rollIn' },
		{ label: '由小变大进入', value: 'zoomIn' },
		{ label: '左变大进入', value: 'zoomInLeft' },
		{ label: '右变大进入', value: 'zoomInRight' },
		{ label: '向上变大进入', value: 'zoomInUp' },
		{ label: '向下变大进入', value: 'zoomInDown' },
		{ label: '向右滑动展开', value: 'slideInLeft' },
		{ label: '向左滑动展开', value: 'slideInRight' },
		{ label: '向上滑动展开', value: 'slideInUp' },
		{ label: '向下滑动展开', value: 'slideInDown' },
		{ label: '弹跳', value: 'bounce' },
		{ label: '闪烁', value: 'flash' },
		{ label: '放大缩小', value: 'pulse' },
		{ label: '放大缩小弹簧', value: 'rubberBand' },
		{ label: '左右晃动', value: 'headShake' },
		{ label: '左右扇形摇摆', value: 'swing' },
		{ label: '放大晃动缩小', value: 'tada' },
		{ label: '扇形摇摆', value: 'wobble' },
		{ label: '左右上下晃动', value: 'jello' },
		{ label: 'Y轴旋转', value: 'flip' },
		{ label: '渐隐', value: 'fadeOut' },
		{ label: '向左退出', value: 'fadeOutLeft' },
		{ label: '向右退出', value: 'fadeOutRight' },
		{ label: '向上退出', value: 'fadeOutUp' },
		{ label: '向下退出', value: 'fadeOutDown' },
		{ label: '向左长距退出', value: 'fadeOutLeftBig' },
		{ label: '向右长距退出', value: 'fadeOutRightBig' },
		{ label: '向上长距退出', value: 'fadeOutUpBig' },
		{ label: '向下长距退出', value: 'fadeOutDownBig' },
		{ label: '旋转退出', value: 'rotateOut' },
		{ label: '左顺时针旋转', value: 'rotateOutDownLeft' },
		{ label: '右逆时针旋转', value: 'rotateOutDownRight' },
		{ label: '左逆时针旋转', value: 'rotateOutUpLeft' },
		{ label: '右逆时针旋转', value: 'rotateOutUpRight' },
		{ label: '弹出', value: 'bounceOut' },
		{ label: '向左弹出', value: 'bounceOutLeft' },
		{ label: '向右弹出', value: 'bounceOutRight' },
		{ label: '向上弹出', value: 'bounceOutUp' },
		{ label: '向下弹出', value: 'bounceOutDown' },
		{ label: '中心X轴旋转', value: 'flipOutX' },
		{ label: '中心Y轴旋转', value: 'flipOutY' },
		{ label: '左长半径旋转', value: 'rollOut' },
		{ label: '由小变大退出', value: 'zoomOut' },
		{ label: '左变大退出', value: 'zoomOutLeft' },
		{ label: '右变大退出', value: 'zoomOutRight' },
		{ label: '向上变大退出', value: 'zoomOutUp' },
		{ label: '向下变大退出', value: 'zoomOutDown' },
		{ label: '向左滑动收起', value: 'slideOutLeft' },
		{ label: '向右滑动收起', value: 'slideOutRight' },
		{ label: '向上滑动收起', value: 'slideOutUp' },
		{ label: '向下滑动收起', value: 'slideOutDown' }
	].map(ele => {
		return { label: ele.label, value: ele.value };
	})
};

function concat(prop, count, type, extend = [], defaults) {
	let list = [];
	for (let i = 1; i <= count; i++) {
		list.push({
			label: prop + i,
			value: `/img/${prop}/${prop}${i}.${extend.includes(i) ? defaults : type}`
		});
	}
	return list;
}
//加载图片素材库
export const imgOption = [
	concat('bg', 3, 'jpg', [1, 2, 3], 'png'),
	concat('border', 100, 'png'),
	concat('source', 100, 'png'),
	concat('source', 4, 'svg'),
	concat('banner', 10, 'png')
];
